# -*- coding:utf-8 -*- 
__date__ = '2022/6/26 8:16 下午'


class Solution:
  def moveZeroes(self, nums):
    # 双指针的做法
    slow = 0
    for fast in range(len(nums)):
      if (nums[fast] !=0):
        nums[slow] = nums[fast]
        slow+=1
    # 补齐后边的零
    nums[slow:] = [0]*(len(nums)-slow)
    return  nums


if __name__ == '__main__':
  nums = [0, 1, 0, 3, 12]
  Solution = Solution()
  Solution.moveZeroes(nums)
  print(nums)
